import { stringify } from 'qs';
import request from '@/utils/request';
import { getPageSize } from '@/utils/common';

export async function selectList(params) {
  params.pageSize = params.pageSize || getPageSize();
  return request(`/server/api/tms/tms-oil/selectList`, {
    method: 'POST',
    body: params,
  });
}
export async function selectDetails(params) {
  return request(`/server/api/tms/tms-oil/selectDetails`, {
    method: 'POST',
    body: params,
  });
}
/**
 * 新增编辑
 */
export async function oilOperate(params) {
  const url = params.id ? 'tms-oil/updateOil' : 'tms-oil/insertOil';

  return request(
    `/server/api/tms/${url}`,
    {
      method: 'POST',
      body: params,
    },
    true
  );
}
export async function oilCardList(params) {
  return request(
    `/server/api/tms/tms-oil/selectOilCard`,
    {
      method: 'POST',
      body: params,
    },
    true
  );
}

/**
 * 生成账单
 */
export async function generatedBills(params) {
  return request(`/server/api/tms/tms-oil/generateBill`, {
    method: 'POST',
    body: params,
  });
}
// 百公里耗油
export async function calHundredConsump(params) {
  return request(`/server/api/tms/tms-oil/calculateHundredConsump`, {
    method: 'POST',
    body: params,
  });
}

//删除加油：
export async function deleteOil(params) {
  return request(`/server/api/tms/tms-oil/deleteTmsOil`, {
    method: 'POST',
    body: params,
  });
}
//确认加油：
export async function oilConfirm(params) {
  return request(`/server/api/tms/tms-oil/addedConfirm`, {
    method: 'POST',
    body: params,
  });
}
export async function selectAll(params) {
  return request(`/server/api/tms/tms-oil/generateBillByCheckAll`, {
    method: 'POST',
    body: params,
  });
}
//刷新油耗
export async function refreshOil(params) {
  return request(`/server/api/tms/tms-archives-oil/refreshOil`, {
      method: 'POST',
      body: params,
  });
}
